package com.findyou.header;

import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Title: HeaderController
 * @Author 贾金博
 * @Package com.findyou.header
 * @Date 2024/3/3 16:31
 * @description: 获取请求头
 */
@RestController
@RequestMapping("header")
public class HeaderController {

    /**
     *查询请求头名字是 Host的请求头对应的值是什么 返回给前端
     * @return
     */
    @RequestMapping("data01")
    public String data(@RequestHeader("Host") String host) {
        System.out.println("host = " + host);
        //log.info("Received request from host: {}", host);
        return "host = " + host; // host = localhost:8080
    }
}
